<template>
    <div class="AddCase" style="overflow-x: hidden;">
        <link href="https://cdn.jsdelivr.net/npm/animate.css@3.5.1" rel="stylesheet" type="text/css">
<!--        分割线-->
        <hr style="border: 1px dashed darkgray;transform: scaleY(0.5); margin-top: -1px">
<!--        步骤条-->
        <el-steps :active="active" finish-status="success" simple style="margin-top: 20px;height: 66px;padding: 13px 1%;">
            <el-step title="选择案件类型" @click.native="steps"></el-step>
            <el-step title="利益冲突审查" @click.native="steps1"></el-step>
            <el-step title="新增委托人" @click.native="steps2"></el-step>
            <el-step title="登记立案信息" @click.native="steps3"></el-step>
            <el-step title="费用减免申请" @click.native="steps4"></el-step>
            <el-step title="立案文书上传"></el-step>
            <el-step title="收案审批" ></el-step>
        </el-steps>
<!--        第一步-->
        <div v-if="active===0" style="margin-top: 30px">
        <span style="font-size: 25px;"><b>选择案件类型</b></span>
        <div class="case_type">
            <ul v-for="(item,index) in caseMenu" :key="index">
                <li>
                    <a :id="item.id" href="javascript:" @click="aClick($event)">
                        <span>{{item.caseTypeName}}</span>
                    </a>
                </li>
            </ul>
        </div>
        <hr style="margin-top: 130px;width: 1260px;margin-left: 12px;">
        <div class="case_item">
            <ul>
                <li v-for="(item,index) in caseMenuChildren" :key="index">
                    <a :id="item.id" href="javascript:" @click="itemClick($event)">
                        <span>{{item.caseTypeName}}</span>
                    </a>
                </li>
            </ul>
        </div>
        </div>
<!--        第二步-->
        <div v-if="active===1" style="margin-top: 30px">
            <span style="font-size: 25px;margin-left: 50px"><b>利益冲突审查</b></span>
            <el-popover
                    placement="top-start"
                    title="小提示"
                    width="200"
                    trigger="hover"
                    content="利益冲突是指本律师事务所代理的委托事项与本所其他委托事项的委托人之间有利益上的冲突，继续代理会直接影响到相关委托人的利益的情形。">
                <i class="el-icon-warning-outline" slot="reference" style="margin-left: 10px;"></i>
            </el-popover>
            <hr style="border: 1px dashed darkgray;width: auto;transform: scaleY(0.5);margin:5px 60px 25px 62px">
            <el-row :gutter="20" style="font-weight:bold;font-size: 18px;margin-bottom: 10px">
                <el-col :span="6" :offset=1><div class="grid-content bg-purple"><span style="color: red;margin-right: 5px">*</span>委托人证件号：</div></el-col>
                <el-col :span="6" :offset=5><div class="grid-content bg-purple"><span style="color: red;margin-right: 5px">*</span>对方当事人证件号：</div></el-col>
            </el-row>
            <el-row :gutter="20">
                <el-form :model="searchCard" :rules="rule" ref="searchCard" label-width="100px" class="demo-ruleForm" onsubmit="return false">
                <el-col :span="10" :offset=1><div class="grid-content bg-purple">
                    <el-form-item label="" prop="cardnum" style="margin-left: -100px">
                    <el-input
                            placeholder="请输入证件号"
                            v-model="searchCard.cardnum"
                            clearable v-on:input="hidden">
                    </el-input>
                    </el-form-item>
                </div></el-col>
                <el-col :span="10" :offset=1><div class="grid-content bg-purple">
                    <el-form-item label="" prop="caseOppositeCardnum" style="margin-left: -100px">
                    <el-input
                            placeholder="请输入证件号"
                            v-model="searchCard.caseOppositeCardnum"
                            clearable v-on:input="hidden">
                    </el-input>
                    </el-form-item>
                </div></el-col>
                </el-form>
            </el-row>
            <el-row>
                <el-col :span="5" :offset=1 style="margin-top: 30px">
                    <el-button type="primary" icon="el-icon-search" @click="queryCaseLaw('searchCard')">搜索</el-button>
                </el-col>
                <el-col :span="5" :offset=1>
                    <transition
                            name="custom-classes-transition"
                            enter-active-class="animated tada"
                            leave-active-class="animated bounceOutRight">
                    <el-button v-if="show" type="success" icon="el-icon-plus" @click="tianjia" style="margin-top: 30px">添加</el-button>
                    </transition>
                </el-col>
            </el-row>
            <hr style="border: 1px dashed darkgray;width: auto;transform: scaleY(0.5);margin:5px 60px 25px 62px">
            <div style="position: absolute;width: 92%;margin-left: 60px;">
            <el-table
                    :data="caseLaw"
                    height="250"
                    border>
                <el-table-column
                        align="center"
                        prop="caseNo"
                        label="案号">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="caseWtr"
                        label="委托人" ref="wtr">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="cardnum"
                        label="委托人证件号" ref="wtr">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="caseOppositeParties"
                        label="对方当事人" ref="dsr">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="caseOppositeCardnum"
                        label="对方当事人证件号" ref="dsr">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="caseAttorney"
                        label="承办律师">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="caseCause"
                        label="案由">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="collectionTime"
                        label="收案日期">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="caseSettleStatus"
                        label="结案情况"
                        :formatter="formatStatus">
                </el-table-column>
            </el-table>
            </div>
        </div>
<!--        第三步-->
        <div v-if="active===2" style="margin-top: 30px">
            <span style="font-size: 25px;margin-left: 50px"><b>基本资料</b></span>
            <hr style="border: 1px dashed darkgray;width: 92%;transform: scaleY(0.5);margin-bottom: 25px">
            <el-form :model="clientForm" ref="clientForm" :rules="rules" label-width="100px" class="demo-clientForm" onsubmit="return false">
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="客户姓名" prop="client">
                            <el-input v-model="clientForm.client" placeholder="请输入客户姓名" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="手机号码" prop="phone">
                            <el-input v-model="clientForm.phone" placeholder="请输入手机号码" clearable></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="客户类型" prop="type">
                            <el-select v-model="clientForm.type" @change="changeType" placeholder="请选择客户类型" style="width: 100%">
                                <span v-for="(item,index) in types" :key="index">
                                    <el-option :value="item.id+''" :label="item.clientType"></el-option>
                                </span>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="身份证号" prop="cardnum">
                            <el-input v-model="clientForm.cardnum" placeholder="请输入身份证号" readonly></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="民族" prop="nation">
                            <el-select v-model="clientForm.nation" style="width: 100%">
                                <el-option value="汉族">汉族</el-option>
                                <el-option value="蒙古族">蒙古族</el-option>
                                <el-option value="回族">回族</el-option>
                                <el-option value="藏族">藏族</el-option>
                                <el-option value="维吾尔族">维吾尔族</el-option>
                                <el-option value="苗族">苗族</el-option>
                                <el-option value="彝族">彝族</el-option>
                                <el-option value="壮族">壮族</el-option>
                                <el-option value="布依族">布依族</el-option>
                                <el-option value="朝鲜族">朝鲜族</el-option>
                                <el-option value="满族">满族</el-option>
                                <el-option value="侗族">侗族</el-option>
                                <el-option value="瑶族">瑶族</el-option>
                                <el-option value="白族">白族</el-option>
                                <el-option value="土家族">土家族</el-option>
                                <el-option value="哈尼族">哈尼族</el-option>
                                <el-option value="哈萨克族">哈萨克族</el-option>
                                <el-option value="傣族">傣族</el-option>
                                <el-option value="黎族">黎族</el-option>
                                <el-option value="傈僳族">傈僳族</el-option>
                                <el-option value="佤族">佤族</el-option>
                                <el-option value="畲族">畲族</el-option>
                                <el-option value="高山族">高山族</el-option>
                                <el-option value="拉祜族">拉祜族</el-option>
                                <el-option value="水族">水族</el-option>
                                <el-option value="东乡族">东乡族</el-option>
                                <el-option value="纳西族">纳西族</el-option>
                                <el-option value="景颇族">景颇族</el-option>
                                <el-option value="柯尔克孜族">柯尔克孜族</el-option>
                                <el-option value="土族">土族</el-option>
                                <el-option value="达斡尔族">达斡尔族</el-option>
                                <el-option value="仫佬族">仫佬族</el-option>
                                <el-option value="羌族">羌族</el-option>
                                <el-option value="布朗族">布朗族</el-option>
                                <el-option value="撒拉族">撒拉族</el-option>
                                <el-option value="毛南族">毛南族</el-option>
                                <el-option value="仡佬族">仡佬族</el-option>
                                <el-option value="锡伯族">锡伯族</el-option>
                                <el-option value="阿昌族">阿昌族</el-option>
                                <el-option value="普米族">普米族</el-option>
                                <el-option value="塔吉克族">塔吉克族</el-option>
                                <el-option value="怒族">怒族</el-option>
                                <el-option value="乌孜别克族">乌孜别克族</el-option>
                                <el-option value="俄罗斯族">俄罗斯族</el-option>
                                <el-option value="鄂温克族">鄂温克族</el-option>
                                <el-option value="德昂族">德昂族</el-option>
                                <el-option value="保安族">保安族</el-option>
                                <el-option value="裕固族">裕固族</el-option>
                                <el-option value="京族">京族</el-option>
                                <el-option value="塔塔尔族">塔塔尔族</el-option>
                                <el-option value="独龙族">独龙族</el-option>
                                <el-option value="鄂伦春族">鄂伦春族</el-option>
                                <el-option value="赫哲族">赫哲族</el-option>
                                <el-option value="门巴族">门巴族</el-option>
                                <el-option value="珞巴族">珞巴族</el-option>
                                <el-option value="基诺族">基诺族</el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="性别" prop="sex">
                            <el-radio-group v-model="clientForm.sex" style="margin-top: 11px;">
                                <el-radio label="M">靓仔</el-radio>
                                <el-radio label="F">靓妹</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-if="clientForm.type==='1'">
                    <el-col :span="23" :offset=1>
                    <el-form-item label="身份特征" prop="typeinfo">
                        <el-checkbox-group v-model="clientForm.typeinfo" style="margin-top: 9px;">
                            <el-checkbox label="妇女"></el-checkbox>
                            <el-checkbox label="未成年人"></el-checkbox>
                            <el-checkbox label="残疾人"></el-checkbox>
                            <el-checkbox label="老年人"></el-checkbox>
                            <el-checkbox label="农民"></el-checkbox>
                            <el-checkbox label="农民工"></el-checkbox>
                            <el-checkbox label="下岗职工"></el-checkbox>
                            <el-checkbox label="城市居民"></el-checkbox>
                            <el-checkbox label="外来人员"></el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-if="clientForm.type==='2'">
                    <el-col :span="23" :offset=1>
                        <el-form-item label="类型" prop="typeinfo">
                            <el-select v-model="clientForm.typeinfo" style="margin-top: 9px;width: 90.5%">
                                <el-option value="政府" label="政府"></el-option>
                                <el-option value="---省级政府" label="---省级政府"></el-option>
                                <el-option value="---市级政府" label="---市级政府"></el-option>
                                <el-option value="---县级政府" label="---县级政府"></el-option>
                                <el-option value="---乡级政府" label="---乡级政府"></el-option>
                                <el-option value="---街道办事处" label="---街道办事处"></el-option>
                                <el-option value="政府部门" label="政府部门"></el-option>
                                <el-option value="---国家部委办" label="---国家部委办"></el-option>
                                <el-option value="---省级政府部门" label="---省级政府部门"></el-option>
                                <el-option value="---市级政府部门" label="---市级政府部门"></el-option>
                                <el-option value="---县级政府部门" label="---县级政府部门"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-if="clientForm.type==='3'">
                    <el-col :span="23" :offset=1>
                        <el-form-item label="类型" prop="typeinfo">
                            <el-select v-model="clientForm.typeinfo" style="margin-top: 9px;width: 90.5%">
                                <el-option value="国有" label="国有"></el-option>
                                <el-option value="民营" label="民营"></el-option>
                                <el-option value="外资" label="外资"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row v-if="clientForm.type==='4'">
                    <el-col :span="23" :offset=1>
                        <el-form-item label="类型" prop="typeinfo">
                            <el-select v-model="clientForm.typeinfo" style="margin-top: 9px;width: 90.5%">
                                <el-option value="商会" label="商会"></el-option>
                                <el-option value="行业协会" label="行业协会"></el-option>
                                <el-option value="其他社团组织" label="其他社团组织"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="3"><span style="font-size: 25px;margin-left: 50px"><b>其他选填</b></span></el-col>
                    <el-col :span="1" style="padding-top: 5px">
                            <el-switch v-model="xt"></el-switch>
                    </el-col>
                </el-row>
                <hr style="border: 1px dashed darkgray;width: 92%;transform: scaleY(0.5);margin-bottom: 25px">
                <div v-if="xt">
                    <el-row>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="邮箱" prop="email">
                                <el-input v-model="clientForm.email" placeholder="请输入邮箱" clearable></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="生日" prop="birth">
                                <el-date-picker type="date" placeholder="选择出生日期" v-model="clientForm.birth" style="width: 100%;"></el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="地区" prop="pertainarea">
                                <el-cascader
                                        ref="cascaderAddr"
                                        size="large"
                                        @change="handleAddressFun"
                                        :options="options"
                                        v-model="this.clientForm.pertainarea"
                                        placeholder="请选择地区"
                                        style="width: 100%">
                                </el-cascader>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="详细地址" prop="address">
                                <el-input v-model="clientForm.address" placeholder="请输入详细地址" clearable></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="21" :offset=1>
                            <el-form-item label="备注" prop="remark">
                                <el-input type="textarea" v-model="clientForm.remark"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>
                <el-form-item>
                    <el-row>
                        <el-col :span="1" :offset=8>
                            <el-button type="primary" @click="clientFormSubmit('clientForm')">立即创建</el-button>
                        </el-col>
                        <el-col :span="1" :offset=2>
                            <el-button @click="resetForm('clientForm')">重置</el-button>
                        </el-col>
                    </el-row>
                </el-form-item>
            </el-form>
        </div>
<!--        第四步-->
        <div v-if="active===3" style="margin-top: 30px">
            <span style="font-size: 25px;margin-left: 50px"><b>基本信息</b></span>
            <hr style="border: 1px dashed darkgray;width: 92%;transform: scaleY(0.5);margin-bottom: 25px">
            <el-form :model="caseForm" ref="caseForm" :rules="rules1" label-width="100px" class="demo-caseForm" onsubmit="return false">
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="案号" prop="caseNo">
                            <el-input v-model="caseForm.caseNo" placeholder="请输入案号" readonly></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="案由" prop="caseCause">
                            <el-input v-model="caseForm.caseCause" placeholder="请输入案由" clearable></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="委托人" prop="caseWtr">
                            <el-input v-model="caseForm.caseWtr" placeholder="请输入委托人" readonly></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="收案日期" prop="collectionTime">
                            <el-date-picker type="date" placeholder="选择收案日期" v-model="caseForm.collectionTime " style="width: 100%;"></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="对方当事人" prop="caseOppositeParties">
                            <el-input v-model="caseForm.caseOppositeParties" placeholder="请输入对方当事人"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                            <el-form-item label="对方证件号" prop="caseOppositeCardnum">
                                <el-input v-model="caseForm.caseOppositeCardnum" placeholder="请输入对方当事人身份证号" readonly></el-input>
                            </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="受理机关" prop="caseAccept">
                            <el-select v-model="caseForm.caseAccept" placeholder="请选择受理机关" style="width: 100%">
                                <span v-for="(item,index) in caseAccept" :key="index">
                                    <el-option :value="item.id+''" :label="item.acceptName"></el-option>
                                </span>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="受理法院" prop="caseCourt">
                            <el-select v-model="caseForm.caseCourt" placeholder="请选择受理法院" style="width: 100%">
                                <span v-for="(item,index) in caseCourt" :key="index">
                                    <el-option :value="item.id+''" :label="item.courtName"></el-option>
                                </span>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="收费方式" prop="caseChargeWay">
                            <el-select v-model="caseForm.caseChargeWay" placeholder="请选择收费方式" style="width: 100%">
                                <el-option value="免费">免费</el-option>
                                <el-option value="计件收费">计件收费</el-option>
                                <el-option value="计时收费">计时收费</el-option>
                                <el-option value="按标的额比例收费">按标的额比例收费</el-option>
                                <el-option value="风险代理收费">风险代理收费</el-option>
                                <el-option value="标的+风险收费">标的+风险收费</el-option>
                                <el-option value="固定+风险收费">固定+风险收费</el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="代理费" prop="caseAgencyfee">
                            <el-input v-model.number="caseForm.caseAgencyfee" placeholder="请输入代理费"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="诉讼标的" prop="caseLawsuitobj">
                            <el-input v-model="caseForm.caseLawsuitobj" placeholder="请输入诉讼标的"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="风险收费" prop="caseFxmoney">
                            <el-input v-model.number="caseForm.caseFxmoney" placeholder="请输入风险收费"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="政府补助" prop="caseSubsidy">
                            <el-select v-model="caseForm.caseSubsidy" @change="selectChange" placeholder="请选择政府补助" style="width: 100%">
                                <el-option value="N" label="否"></el-option>
                                <el-option value="Y" label="是"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10"  :offset=1>
                        <el-form-item label="补助金额" prop="caseSubsidysal">
                            <el-input v-model.number="caseForm.caseSubsidysal" :readonly="readonly" placeholder="请输入补助金额"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="23" :offset=1>
                        <el-form-item label="诉讼阶段" prop="caseStatus">
                            <el-radio-group v-model="caseForm.caseStatus" style="margin-top: 11px;">
                                <el-radio label="立案">立案</el-radio>
                                <el-radio label="一审">一审</el-radio>
                                <el-radio label="二审">二审</el-radio>
                                <el-radio label="执行">执行</el-radio>
                                <el-radio label="再审">再审</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="23" :offset=1>
                        <el-form-item label="诉讼地位" prop="caseLawsuitStatus">
                            <el-radio-group v-model="caseForm.caseLawsuitStatus" style="margin-top: 11px;">
                                <el-radio label="原告">原告</el-radio>
                                <el-radio label="被告">被告</el-radio>
                                <el-radio label="上诉人">上诉人</el-radio>
                                <el-radio label="被上诉人">被上诉人</el-radio>
                                <el-radio label="申请执行人">申请执行人</el-radio>
                                <el-radio label="被申请执行人">被申请执行人</el-radio>
                                <el-radio label="申请人">申请人</el-radio>
                                <el-radio label="被申请人">被申请人</el-radio>
                                <el-radio label="第三人">第三人</el-radio>
                                <el-radio label="其他">其他</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="3"><span style="font-size: 25px;margin-left: 50px"><b>其他选填</b></span></el-col>
                    <el-col :span="1" style="padding-top: 5px">
                        <el-switch v-model="xt"></el-switch>
                    </el-col>
                </el-row>
                <hr style="border: 1px dashed darkgray;width: 92%;transform: scaleY(0.5);margin-bottom: 25px">
                <div v-if="xt">
                    <el-row>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="专属案号" prop="casePropernum">
                                <el-input v-model="caseForm.casePropernum" placeholder="请输入专属案号"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10"  :offset=1>
                            <el-form-item label="杂费" prop="caseProxysal">
                                <el-input v-model="caseForm.caseProxysal" placeholder="请输入杂费"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="办案地区" prop="caseTransactionRegion">
                                <el-cascader
                                        ref="cascaderAddr"
                                        size="large"
                                        @change="handleAddressFun"
                                        :options="options"
                                        v-model="this.caseForm.caseTransactionRegion"
                                        placeholder="请选择地区"
                                        style="width: 100%">
                                </el-cascader>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="是否指派" prop="caseAssign">
                                <el-select v-model="caseForm.caseAssign" placeholder="请选择是否指派" style="width: 100%">
                                    <el-option value="N">否</el-option>
                                    <el-option value="Y">是</el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="第三人" prop="caseThirdParty">
                                <el-input v-model="caseForm.caseThirdParty" placeholder="请输入第三人"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10" :offset=1>
                            <el-form-item label="相关文件" prop="caseCorrelationFile">
                                <el-button type="primary" @click="fileUp">上传文件<i class="el-icon-upload el-icon--right"></i></el-button>
                                <el-upload
                                        class="upload-demo"
                                        ref="upload"
                                        action=""
                                        :limit="1"
                                        :http-request="submitUpload"
                                        :before-upload="beforeUpload"
                                        :on-exceed="onExceed"
                                        v-show="false">
                                    <el-button ref="xzwj">选取文件</el-button>
                                </el-upload>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="21" :offset=1>
                            <el-form-item label="备注" prop="caseRemarks">
                                <el-input type="textarea" v-model="caseForm.caseRemarks"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>
            </el-form>
            <span style="font-size: 25px;margin-left: 50px"><b>办案律师</b></span>
            <hr style="border: 1px dashed darkgray;width: 92%;transform: scaleY(0.5);margin-bottom: 25px">
            <el-form :model="cwForm" ref="cwForm" :rules="rules2" label-width="100px" class="demo-cwForm" onsubmit="return false">
                <el-row>
                    <el-col :span="5">
                        <el-form-item prop="caseAttorney">
                            <el-input v-model="cwForm.caseAttorney" readonly></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5" style="margin-left: -99px">
                        <el-form-item prop="zhuBanLvShi">
                            <el-input v-model="cwForm.zhuBanLvShi" readonly></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5" :offset=1>
                        <el-form-item label="业绩分成" prop="cwPerformancesplit">
                            <el-input v-model.number="cwForm.cwPerformancesplit" placeholder="请输入业绩分成"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5" style="margin-left: -99px">
                        <el-form-item prop="cwSplitType">
                            <el-select v-model="cwForm.cwSplitType" style="width: 200px">
                                <el-option value="百分比">百分比</el-option>
                                <el-option value="固定金额">固定金额</el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="3" :offset=1>
                        <el-button @click="addRows" type="primary">增加一行</el-button>
                    </el-col>
                </el-row>
                <el-row v-for="(item,index) in cwForm.rows" :key="index">
                        <el-col :span="5">
                            <el-form-item :rules="rules2.caseAttorney" :prop="'rows.'+index+'.caseAttorney'">
                                <el-select v-model="item.caseAttorney" style="width: 205px">
                                    <el-option value="督办律师">督办律师</el-option>
                                    <el-option value="协助律师">协助律师</el-option>
                                    <el-option value="实习律师">实习律师</el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="5" style="margin-left: -99px">
                            <el-form-item :rules="rules2.zhuBanLvShi" :prop="'rows.'+index+'.zhuBanLvShi'">
                                <el-input v-model="item.zhuBanLvShi" readonly="readonly" placeholder="点击选择律师" @click.native="choiceLawyersDialog(index)"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="5" :offset=1>
                            <el-form-item label="业绩分成" :rules="rules2.cwPerformancesplit" :prop="'rows.'+index+'.cwPerformancesplit'">
                                <el-input v-model.number="item.cwPerformancesplit" placeholder="请输入业绩分成"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="5" style="margin-left: -99px">
                            <el-form-item :rules="rules2.cwSplitType" :prop="'rows.'+index+'.cwSplitType'">
                                <el-select v-model="item.cwSplitType" style="width: 200px">
                                    <el-option value="百分比">百分比</el-option>
                                    <el-option value="固定金额">固定金额</el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="3" :offset=1>
                            <el-button @click="reRows(index)" type="danger">删除</el-button>
                        </el-col>
                </el-row>
                <el-form-item>
                    <el-row>
                        <el-col :span="1" :offset=8>
                            <el-button type="primary" @click="clientFormSubmit('caseForm')">立即创建</el-button>
                        </el-col>
                        <el-col :span="1" :offset=2>
                            <el-button @click="resetForm('caseForm')">重置</el-button>
                        </el-col>
                    </el-row>
                </el-form-item>
            </el-form>
            <el-dialog
                    title="请选择办案律师"
                    :visible.sync="getLawyersList"
                    width="50%">
<!--                    :before-close="handleClose"-->
                <span>
                    <el-table
                            @row-click="rowClick"
                            :data="LawyersList"
                            border
                            style="width: 100%">
                        <el-table-column
                                prop="id"
                                label="编号"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="empName"
                                label="姓名"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="empSex"
                                label="性别"
                                :formatter="sexFormatter">
                        </el-table-column>
                        <el-table-column
                                prop="empPosition"
                                label="职务">
                        </el-table-column>
                        <el-table-column
                                prop="empPhone"
                                label="电话">
                        </el-table-column>
                    </el-table>
                </span>
                <span slot="footer" class="dialog-footer">
<!--                    <el-button @click="getLawyersList = false">取 消</el-button>-->
                    <el-button type="primary" @click="getLawyersList = false">取 消</el-button>
                </span>
            </el-dialog>
        </div>
<!--        第五步-->
        <div v-if="active===4" style="margin-top: 30px">
            <span style="font-size: 25px;margin-left: 50px"><b>案件信息</b></span>
            <hr style="border: 1px dashed darkgray;width: 90%;transform: scaleY(0.5);margin-bottom: 25px;margin-left: 60px">
            <div style="position: absolute;width: 90%;">
            <el-table
                    :data="caseArray"
                    border
                    style="width: 1325px;margin-left: 60px;margin-bottom: 30px">
                <el-table-column
                        prop="caseNo"
                        label="案号"
                        width="180"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseWtr"
                        label="委托人"
                        width="180"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseCause"
                        label="案由"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseLawsuitStatus"
                        label="诉讼地位"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseStatus"
                        label="诉讼阶段"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseAgencyfee"
                        label="代理费"
                        align="center">
                </el-table-column>
            </el-table>
            </div>
            <div style="margin-top: 150px">
            <span style="font-size: 25px;margin-left: 50px;"><b>减免申请</b></span>
            <hr style="border: 1px dashed darkgray;width: 90%;transform: scaleY(0.5);margin-bottom: 25px;margin-left: 60px">
            <el-form :model="cdForm" ref="cdForm" :rules="rules3" label-width="110px" class="demo-cdForm" onsubmit="return false">
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="申请人" prop="person">
                            <el-input v-model="cdForm.person" placeholder="请输入申请人" readonly></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="申请减免金额" prop="decreaseMoney">
                            <el-input v-model.number="cdForm.decreaseMoney" placeholder="请输入申请减免金额"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="申请日期" prop="applyDate">
                            <el-date-picker type="date" placeholder="选择申请日期" v-model="cdForm.applyDate " style="width: 100%;"></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10" :offset=1>
                        <el-form-item label="相关文件" prop="filepath">
                            <el-button type="primary" @click="fileUp">上传文件<i class="el-icon-upload el-icon--right"></i></el-button>
                            <el-upload
                                    class="upload-demo"
                                    ref="upload"
                                    action=""
                                    :limit="1"
                                    :http-request="submitUpload"
                                    :before-upload="beforeUpload"
                                    :on-exceed="onExceed"
                                    v-show="false">
                                <el-button ref="xzwj">选取文件</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="21" :offset=1>
                        <el-form-item label="备注" prop="reason">
                            <el-input type="textarea" v-model="cdForm.reason"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item>
                    <el-row>
                        <el-col :span="3" :offset=5>
                            <el-button type="info" @click="notcd">无需费用减免,下一步</el-button>
                        </el-col>
                        <el-col :span="1" :offset=2>
                            <el-button type="primary" @click="clientFormSubmit('cdForm')" style="margin-left: -10px">立即创建</el-button>
                        </el-col>
                        <el-col :span="1" :offset=2>
                            <el-button @click="resetForm('cdForm')">重置</el-button>
                        </el-col>
                    </el-row>
                </el-form-item>
            </el-form>
            </div>
        </div>
        <!--        第六步-->
        <div v-if="active===5" style="margin-top: 30px">
            <span style="font-size: 25px;margin-left: 50px"><b>立案文书上传</b></span>
            <hr style="border: 1px dashed darkgray;width: 90%;transform: scaleY(0.5);margin-bottom: 25px;margin-left: 60px">
            <div v-if="lianwenshu">
            <el-row>
                <el-col :span="5" :offset=10>
                    <div style="font-size: 25px">案号:{{caseArray[0].caseNo}}</div>
                </el-col>
            </el-row>
            <el-row style="margin-top: 30px">
                <el-col :span="5" :offset=6>
                    <el-button type="info" @click="automatic" style="width: 300px;height: 200px;font-size: 30px">自动生成模式</el-button>
                </el-col>
                <el-col :span="5" :offset=1>
                    <el-button type="info" @click="manual" style="width: 300px;height: 200px;font-size: 30px">手动上传模式</el-button>
                </el-col>
            </el-row>
            <el-row style="margin-top: 50px">
                <el-col :span="5" :offset=10>
                    <el-button type="primary" @click="notcd" style="height: 50px;font-size: 15px">暂不上传文书,下一步</el-button>
                </el-col>
            </el-row>
            </div>
            <div v-if="!lianwenshu">
                <AddCaseSealApplyfor :activeName="activeName" :case="caseForm" @changeActive="changeActive"></AddCaseSealApplyfor>
            </div>
        </div>
        <!--        第七步-->
        <div v-if="active===6" style="margin-top: 30px">
            <span style="font-size: 25px;margin-left: 50px"><b>案件信息</b></span>
            <hr style="border: 1px dashed darkgray;width: 90%;transform: scaleY(0.5);margin-bottom: 25px;margin-left: 60px">
            <div style="position: absolute;width: 90%">
            <el-table
                    :data="caseData"
                    border
                    style="width: 1325px;margin-left: 60px;margin-bottom: 30px">
                <el-table-column
                        prop="caseNo"
                        label="案号"
                        width="180"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseCaseTypeName"
                        label="案件类型"
                        width="180"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseCause"
                        label="案由"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseWtr"
                        label="委托人"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseAttorney"
                        label="承办律师"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="collectionTime"
                        label="收案时间"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseSettleStatus"
                        label="结案状态"
                        align="center"
                        :formatter="settleFormatter">
                </el-table-column>
                <el-table-column
                        prop="caseAgencyfee"
                        label="代理费"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="caseApproveStatus"
                        label="收案审批"
                        align="center"
                        :formatter="approveFormatter">
                </el-table-column>
            </el-table>
            </div>
        </div>
        <div v-if="active===7">
            <AddCaseAgency case-id="" add-case="1" @back="back"></AddCaseAgency>
        </div>
    </div>
</template>

<script>
    import AddCaseService from "../../model/AddCaseService";
    import { regionData  } from 'element-china-area-data'
    import AddCaseSealApplyfor from "./AddCaseSealApplyfor";
    import AddCaseAgency from "./AddCaseAgency";
    import $ from "jquery"

    const addCaseService =AddCaseService.getInstance();
    export default {
        name: "AddCase",
        components: {
            AddCaseSealApplyfor,
            AddCaseAgency
        },
        data(){
            return{
                options: regionData ,//省市区级联
                active:0,//当前所在步骤
                caseMenu:"",//案件类型
                caseMenuChildren:"",//子案件类型
                // caseType:"",//存储案件类型
                // cardnum:"",//委托人证件号
                caseLaw:[],//冲突案件列表
                show:false,//添加按钮隐藏
                client:"",//存储客户姓名
                caseAccept:[],//受理机关
                caseCourt:[],//受理法院
                types:[], //客户类型数据
                xt:false,//switch 滑块
                files:'',//文件
                fileName:'',//文件名
                getLawyersList:false,//查询律师列表对话框
                LawyersList:[],//办案律师列表
                zhuBanLvShiIndex:"",//主办律师下标
                caseArray:[],//费用减免上方显示的案件数据
                caseData:[],//收案审批显示的案件数据
                lianwenshu:true,//立案文书界面转换
                activeName:"",//激活页面
                readonly:false,//是否只读
                caseTypeContext:"",//案件类型

                searchCard:{//搜索身份证号表单
                    cardnum:"",//身份证号
                    caseOppositeCardnum:"",//对方当事人证件号
                },
                rule:{//搜索身份证号表单验证
                    cardnum:[
                        {pattern:"^([1-6][1-9]|50)\\d{4}(18|19|20)\\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",message:"身份证号无效"}
                    ],
                    caseOppositeCardnum:[
                        {pattern:"^([1-6][1-9]|50)\\d{4}(18|19|20)\\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",message:"身份证号无效"}
                    ]
                },
                clientForm:{//委托人表单
                    clientId:"",//客户id
                    client:"",//客户姓名
                    phone:"",//客户电话
                    type:"",//客户类型
                    cardnum:"",//身份证号
                    typeinfo:[],//身份特征
                    sex:"M",//性别
                    nation:"",//民族
                    email:"",//邮箱
                    pertainarea:[],//地区
                    birth:null,//客户生日
                    remark:"",//备注
                },
                rules:{//委托人表单验证
                    client:[
                        {pattern:"^[\u4e00-\u9fa5]{2,4}$",required:true,message:"姓名为2-4字！",trigger:"blur"}
                    ],
                    phone:[
                        {pattern:"^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$",required:true,message:"请输入有效电话！"}
                    ],
                    type:[
                        {required:true,message:"请选择客户类型！",trigger:"blur"}
                    ],
                    nation:[
                        {required:true,message:"请选择民族！",trigger:"blur"}
                    ],
                    typeinfo:[
                        {required:true,message:"至少选择一项！"}
                    ],
                    email:[
                        {pattern:"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$",message:"邮箱格式不正确!",trigger:"blur"}
                    ],
                },

                caseForm:{//案件表单
                    clientId:"",//客户id
                    caseLawId:"",//案号id
                    caseNo:"",//案号
                    caseCause:"",//案由
                    caseWtr:"",//委托人
                    collectionTime:"",//收案日期
                    caseOppositeParties:"",//对方当事人
                    caseOppositeCardnum:"",//对方当事人身份证号
                    caseAccept:"",//受理机关
                    caseCourt:"",//受理法院
                    caseChargeWay:"",//收费方式
                    caseAgencyfee:"",//代理费
                    caseLawsuitobj:"",//诉讼标的
                    caseFxmoney:"",//风险收费
                    caseSubsidy:"",//政府补助
                    caseSubsidysal:"",//补助金额
                    caseStatus:"",//诉讼阶段
                    caseUnpaidsal:"",//未付金额
                    caseLawsuitStatus:"",//诉讼地位
                    casePropernum:"",//专属案号
                    caseProxysal:"0",//杂费
                    caseTransactionRegion:[],//办案地区
                    caseAssign:null,//是否指派
                    caseThirdParty:"",//第三人
                    caseCorrelationFile:"",//相关文件
                    caseRemarks:"",//备注
                    caseCaseTypeId:"",//案件类型id
                },
                rules1:{//案件表单验证规则
                    caseNo:[
                        {required:true,message:"请输入案号!",trigger:"blur"}
                    ],
                    caseCause:[
                        {required:true,message:"请输入案由!",trigger:"blur"}
                    ],
                    caseWtr:[
                        {required:true,message:"请输入委托人!",trigger:"blur"}
                    ],
                    collectionTime:[
                        {required:true,message:"请选择收案日期!",trigger:"blur"}
                    ],
                    caseOppositeParties:[
                        {required:true,message:"请输入对方当事人!",trigger:"blur"}
                    ],
                    caseOppositeCardnum:[
                        {required:true,message:"请输入对方当事人证件号!",trigger:"blur"}
                    ],
                    caseAccept:[
                        {required:true,message:"请选择受理机关!",trigger:"blur"}
                    ],
                    caseCourt:[
                        {required:true,message:"请选择受理法院!",trigger:"blur"}
                    ],
                    caseChargeWay:[
                        {required:true,message:"请选择收费方式!",trigger:"blur"}
                    ],
                    caseAgencyfee:[
                        {required:true,message:"请输入代理费!",trigger:"blur"},
                        {type:"number",message: "请正确输入代理费!(数字类型)"}
                    ],
                    caseLawsuitobj:[
                        {required:true,message:"请输入诉讼标的!",trigger:"blur"}
                    ],
                    caseFxmoney:[
                        {required:true,message:"请输入风险收费!",trigger:"blur"},
                        {type:"number",message: "请正确输入风险收费!(数字类型)"}
                    ],
                    caseSubsidy:[
                        {required:true,message:"请选择政府补助!",trigger:"blur"}
                    ],
                    caseSubsidysal:[
                        {required:true,message:"请输入补助金额!",trigger:"blur"},
                        {type:"number",message: "请正确输入补助金额!(数字类型)"}
                    ],
                    caseStatus:[
                        {required:true,message:"至少选择一项!",trigger:"blur"}
                    ],
                    caseLawsuitStatus:[
                        {required:true,message:"至少选择一项!",trigger:"blur"}
                    ],
                    caseProxysal:[
                        {pattern:"^[0-9]*$",message:"请正确输入杂费!(数字类型)",trigger:"blur"}
                    ],
                },
                cwForm:{//办案律师分成表单
                    caseAttorney:"主办律师",//主办律师
                    hrEmpId:"",//主办律师id
                    zhuBanLvShi:"",//主办律师
                    cwPerformancesplit:"",//百分比
                    cwSplitType:"",//模式
                    cwRealSplitMoney:"",//实际提成金额
                    rows:[],//添加一行
                },
                rules2:{//办案律师分成表单验证规则
                    caseAttorney:[
                        {required:true,message:"请选择律师类型!",trigger:"blur"}
                    ],
                    zhuBanLvShi:[
                        {required:true,message:"请选择律师!",trigger:"blur"}
                    ],
                    cwPerformancesplit:[
                        {type:"number",required:true,message:"业绩分成应为数字类型!",trigger:"blur"}
                    ],
                    cwSplitType:[
                        {required:true,message:"请选择分成模式!",trigger:"blur"}
                    ]
                },
                cdForm:{//费用减免申请表单
                    caseLawId:"",//案号id
                    person:"",//申请人
                    decreaseMoney:"",//申请减免金额
                    applyDate:"",//申请日期
                    filepath:"",//相关文件
                    reason:"",//备注
                },
                rules3:{//费用减免申请表单验证规则
                    person:[
                        {required:true,message:"请输入申请人!",trigger:"blur"}
                    ],
                    decreaseMoney:[
                        {type:"number",required:true,message:"请正确输入申请减免金额!",trigger:"blur"}
                    ],
                    applyDate:[
                        {required:true,message:"请输入申请日期!",trigger:"blur"}
                    ],
                    reason:[
                        {required:true,message:"请填写备注信息!",trigger:"blur"}
                    ]
                },
            }
        },

        created() {
            this.queryCct();
        },
        methods:{
            change(){
              console.log(this.clientForm.typeinfo)
            },
            changeType(val){//客户类型改变事件
                if(val==="1"||val==="5"){
                    this.clientForm.typeinfo=[]
                }else{
                    this.clientForm.typeinfo=""
                }
            },
            back(){
              this.active=0
            },
            steps(){
                this.active=0;
            },
            steps1(){
                if(this.active>1){
                    this.active=1;
                }
            },
            steps2(){
                if(this.active>2){
                    this.active=2;
                }
            },
            steps3(){
                if(this.active>3){
                    this.active=3;
                }
            },
            steps4(){
                if(this.active>4){
                    if(this.clientForm.typeinfo.length===0){
                        this.$message({
                            type:"info",
                            message:"您暂不符合费用减免标准~"
                        })
                    }else{
                        if(this.clientForm.typeinfo.indexOf("未成年")!==-1||
                            this.clientForm.typeinfo.indexOf("残疾")!==-1||
                            this.clientForm.typeinfo.indexOf("老年")!==-1||
                            this.clientForm.typeinfo.indexOf("农民")!==-1){
                            this.active=4;
                        }else{
                            this.$message({
                                type:"info",
                                message:"您暂不符合费用减免标准~"
                            })
                        }
                    }
                }
            },
            selectChange(val){//政府补助改变事件
              if(val==="N"){
                  this.readonly=true;
                  this.caseForm.caseSubsidysal=0
              }else{
                  this.readonly=false
              }
            },
            changeActive(params){//子组件回调
                this.active+=parseInt(params);
                addCaseService.upCaseAt(this.$http,this.caseForm.caseLawId);
            },
            approveFormatter(row, column, cellValue){//收案审批状态
                if(cellValue==="1"){
                    return "审批中"
                }else if(cellValue==="2"){
                    return "审批通过"
                }else{
                    return "审批不通过"
                }
            },
            settleFormatter(row, column, cellValue){//结案状态
                if(cellValue==="N"){
                    return "未结案"
                }else{
                    return "已结案"
                }
            },
            automatic(){//自动生成模式
                this.activeName='second';
                this.lianwenshu=false
            },
            manual(){//手动上传模式
                this.activeName='first';
                this.lianwenshu=false
            },
            notcd(){//无需费用减免,下一步
                this.active++
            },
            rowClick(row){//办案律师表格点击事件//, column, event
                this.cwForm.rows[this.zhuBanLvShiIndex].hrEmpId=row.id;
                this.cwForm.rows[this.zhuBanLvShiIndex].zhuBanLvShi=row.empName;
                this.getLawyersList=false;
            },
            sexFormatter(row, column, cellValue){//性别转换
                if(cellValue==="M"){
                    return "男"
                }else{
                    return "女"
                }
            },
            choiceLawyersDialog(index){//选择办案律师对话框
                if(this.LawyersList.length===0){
                    addCaseService.queryHrEmp(this.$http).then(msg=>{
                        this.LawyersList=msg.data.data;
                    });
                }
                this.zhuBanLvShiIndex=index;
                this.getLawyersList=true;
            },
            reRows(index){//删除一行
                this.cwForm.rows.splice(index, 1)
            },
            addRows(){//添加一行
                const rows={
                    caseAttorney:"",//律师
                    caseLawId:"",//案件id
                    hrEmpId:"",//律师id
                    zhuBanLvShi:"",//律师
                    cwPerformancesplit:"",//业绩分成
                    cwSplitType:"",//分成模式
                    cwRealSplitMoney:"",//实际提成金额
                };
                this.cwForm.rows.push(rows)
            },
            fileUp(){//文件上传点击事件
                this.$refs.xzwj.$el.click()
            },
            onExceed(){//文件个数超出限制时
                this.$message({
                    type:"warning",
                    message:"本次文件上传已达限制"
                })
            },
            beforeUpload(file){//文件上传之前
                this.files=file;
                this.fileName=file.name;
            },
            submitUpload() {//文件上传提交事件
                if (this.fileName === "") {
                    this.$message.warning('请选择要上传的文件！');
                    return false
                }
                let fileFormData = new FormData();
                fileFormData.append('file', this.files, this.fileName);//file是键，files是值，就是要传的文件，fileName是要传的文件名
                let requestConfig = {
                    headers: {
                        'Content-Type': 'multipart/form-data'
                    },
                };
                addCaseService.fileUp(fileFormData,requestConfig,this.$http).then(msg=>{
                    if(this.active===3){
                        this.caseForm.caseCorrelationFile=msg.data.data
                    }else{
                        this.cdForm.filepath=msg.data.data
                    }
                    this.$message({
                        type:"success",
                        message:"上传成功~"
                    })
                })
            },
            handleAddressFun(item){//手动获取地区
                this.clientForm.pertainarea=item;
            },
            clientFormSubmit(formName){//提交委托人表单
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.$loading({//懒加载
                            lock: true,
                            text: '正在添加...',
                            spinner: 'fa fa-refresh fa-spin fa-3x',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });
                        if(formName==="clientForm"){
                            if(this.clientForm.birth!==null){
                                this.clientForm.birth=this.$date.formatDate(this.clientForm.birth, "yyyy-MM-DD");
                            }
                            if(this.clientForm.type==="1"||this.clientForm.type==="5"){
                                this.clientForm.typeinfo=this.clientForm.typeinfo.join(",");
                            }
                            this.clientForm.pertainarea=this.clientForm.pertainarea.join(",");
                            let formData = new FormData();
                            for(const key in this.clientForm){
                                if(Object.prototype.hasOwnProperty.call(this.clientForm, key)){
                                    if(this.clientForm[key]!=null){
                                        formData.append(key,this.clientForm[key]);
                                    }
                                }
                            }
                            const date = this.$date.formatDate(new Date(), "yyyy-MM-DD hh:mm:ss");//yyyy-MM-DD hh:mm:ss
                            formData.append("addtime",date);
                            this.client=this.clientForm.client;
                            addCaseService.addClient(this.$http,formData).then(msg=>{
                                if(msg.data.status==="50000"){
                                    this.$message({
                                        type:"error",
                                        message:"出错了呢~"
                                    });
                                    this.$loading().close()
                                }else{
                                    this.clientForm.clientId=msg.data.data;
                                    this.caseForm.clientId=msg.data.data;
                                    this.$message({
                                        type:"success",
                                        message:"成功添加委托人~"
                                    });
                                    console.log(this.clientForm.typeinfo);
                                    this.caseDataPreparation();
                                    this.active++;
                                    this.$loading().close()
                                }
                            })
                        }else if(formName==="caseForm"){
                            this.$refs.cwForm.validate((valid) => {
                                if (valid){
                                    this.caseForm.caseUnpaidsal=parseInt(this.caseForm.caseAgencyfee)+parseInt(this.caseForm.caseProxysal)
                                    +parseInt(this.caseForm.caseFxmoney)-parseInt(this.caseForm.caseSubsidysal);
                                    this.caseForm.collectionTime=this.$date.formatDate(this.caseForm.collectionTime, "yyyy-MM-DD");
                                    if(this.caseForm.caseTransactionRegion.length!==0){
                                        this.caseForm.caseTransactionRegion=this.caseForm.caseTransactionRegion.join(",");
                                    }
                                    let formData = new FormData();
                                    for(const key in this.caseForm){
                                        if(Object.prototype.hasOwnProperty.call(this.caseForm, key)){
                                            if(this.caseForm[key]!=null){
                                                formData.append(key,this.caseForm[key]);
                                            }
                                        }
                                    }
                                    const date = this.$date.formatDate(new Date(), "yyyy-MM-DD hh:mm:ss");//yyyy-MM-DD hh:mm:ss
                                    formData.append("caseSubtime",date);
                                    formData.append("caseSubmitter",JSON.parse(localStorage["user"])[0].userRealname);
                                    formData.append("hrEmpId",JSON.parse(localStorage["user"])[0].hrEmpId);
                                    addCaseService.addCaseLaw(this.$http,formData).then(msg=>{
                                        if(msg.data.status==="50000"){
                                            this.$message({
                                                type:"error",
                                                message:"出错了呢~"
                                            });
                                            this.$loading().close()
                                        }else {
                                            this.cdForm.caseLawId=msg.data.data;
                                            this.caseForm.caseLawId=msg.data.data;
                                            const performancesplit={
                                                caseAttorney:this.cwForm.caseAttorney,//主办律师
                                                caseLawId:msg.data.data,//案件id
                                                hrEmpId:JSON.parse(localStorage["user"])[0].hrEmpId,//主办律师id
                                                zhuBanLvShi:this.cwForm.zhuBanLvShi,//主办律师
                                                cwPerformancesplit:this.cwForm.cwPerformancesplit,//业绩分成
                                                cwSplitType:this.cwForm.cwSplitType,//分成模式
                                                cwRealSplitMoney:"",//实际提成金额
                                            };
                                            let rows=[];
                                            rows.push(performancesplit);
                                            for (let i = 0; i < this.cwForm.rows.length; i++) {
                                                this.cwForm.rows[i].caseLawId=msg.data.data;
                                                rows.push(this.cwForm.rows[i])
                                            }
                                            addCaseService.addcwPerformancesplit(this.$http,rows).then(msg=>{
                                                if(msg.data.status==="50000"){
                                                    this.$message({
                                                        type:"error",
                                                        message:"出错了呢~"
                                                    });
                                                    this.$loading().close()
                                                }else{
                                                    this.$message({
                                                        type: "success",
                                                        message: "立案成功~"
                                                    });
                                                    const params={
                                                        id:this.caseForm.caseLawId
                                                    };
                                                    addCaseService.upCaseAt(this.$http,this.caseForm.caseLawId).then(()=>{
                                                        addCaseService.querySenior(this.$http,params).then(msg=>{
                                                            this.caseData=msg.data.data.list
                                                        });
                                                    });
                                                    this.cdForm.person=this.caseForm.caseWtr;
                                                    this.caseArray=[{
                                                        caseNo:this.caseForm.caseNo,
                                                        caseWtr:this.caseForm.caseWtr,
                                                        caseCause:this.caseForm.caseCause,
                                                        caseLawsuitStatus:this.caseForm.caseLawsuitStatus,
                                                        caseStatus:this.caseForm.caseStatus,
                                                        caseAgencyfee:this.caseForm.caseAgencyfee
                                                    }];
                                                    if(this.clientForm.typeinfo.length===0){
                                                        this.active+=2;
                                                    }else{
                                                        if((this.clientForm.typeinfo.indexOf("未成年")!==-1||
                                                            this.clientForm.typeinfo.indexOf("残疾")!==-1||
                                                            this.clientForm.typeinfo.indexOf("老年")!==-1||
                                                            this.clientForm.typeinfo.indexOf("农民")!==-1)){
                                                            this.active++;
                                                        }else{
                                                            this.active+=2;
                                                        }
                                                    }
                                                }
                                                this.$loading().close()
                                            });
                                        }
                                    })
                                }
                            });
                        }else{
                            this.cdForm.applyDate=this.$date.formatDate(this.cdForm.applyDate, "yyyy-MM-DD");
                            let formData = new FormData();
                            for(const key in this.cdForm){
                                if(Object.prototype.hasOwnProperty.call(this.cdForm, key)){
                                    if(this.cdForm[key]!=null){
                                        formData.append(key,this.cdForm[key]);
                                    }
                                }
                            }
                            addCaseService.addCaseDecrease(this.$http,formData).then(msg=>{
                                if(msg.data.status==="50000"){
                                    this.$message({
                                        type:"error",
                                        message:"出错了呢~"
                                    });
                                    this.$loading().close()
                                }else{
                                    this.$message({
                                        type: "success",
                                        message: "提交成功~"
                                    });
                                    const param=new URLSearchParams();
                                    param.append("id",this.caseForm.caseLawId);
                                    param.append("standard", this.cdForm.decreaseMoney);
                                    param.append("type",1);
                                    param.append("caseUnpaidsal",this.cdForm.decreaseMoney);
                                    addCaseService.upCaseLaw(this.$http, param);
                                    this.active++;
                                    this.$loading().close()
                                }
                            })
                        }
                    } else {
                        this.$message({
                            type:"error",
                            message:"请正确填写信息!"
                        });
                        return false;
                    }
                });
            },
            resetForm(formName) {//重置表单
                this.$refs[formName].resetFields();
            },
            queryTypes(){//查询客户类型
                addCaseService.queryTypes(this.$http).then(msg=>{
                    this.types=msg.data.data
                })
            },
            queryCct(){//查询案件类型
                addCaseService.queryCct(this.$http).then(msg=>{
                    this.caseMenu=msg.data.data.data
                });
            },
            aClick(event){//查询子案件类型
                const id = event.currentTarget.id;
                if(id==="1011"){
                    this.active=7
                }else{
                    this.$loading({//懒加载
                        lock: true,
                        text: '正在查询...',
                        spinner: 'fa fa-refresh fa-spin fa-3x',
                        background: 'rgba(0, 0, 0, 0.7)'
                    });
                    this.caseTypeContext=event.currentTarget.innerText.substring(0,1)
                    addCaseService.queryChildren(this.$http,id).then(msg=>{
                        this.caseMenuChildren=msg.data.data.data
                        this.$loading().close()
                    })
                }
            },
            itemClick(event){//跳转第二步
                this.$message({
                    type:"info",
                    message:"可点击步骤条进行返回哦~"
                });
                this.caseForm.caseCaseTypeId=event.currentTarget.id;
                this.active++
            },
            queryCaseLaw(formName){//利益审查
                if(this.searchCard.caseOppositeCardnum===""||this.searchCard.cardnum===""){
                    this.$message({
                        type:"error",
                        message:"请填写委托人&对方当事人证件号!"
                    })
                }else if(this.searchCard.caseOppositeCardnum===this.searchCard.cardnum){
                    this.$message({
                        type:"error",
                        message:"委托人&对方当事人证件号不可以相同哟~"
                    })
                }else{
                    this.$refs[formName].validate((valid) => {
                        if (valid) {
                            this.$loading({//懒加载
                                lock: true,
                                text: '正在查询...',
                                spinner: 'fa fa-refresh fa-spin fa-3x',
                                background: 'rgba(0, 0, 0, 0.7)'
                            });
                            const params={
                                cardnum:this.searchCard.cardnum
                            };
                            addCaseService.seniorQuery(this.$http,params).then(msg=>{
                                if(msg.data.data.length!==0) {
                                    this.clientForm.clientId=msg.data.data[0].id;
                                    this.caseForm.clientId=msg.data.data[0].id;
                                    this.client=msg.data.data[0].client;
                                    this.clientForm.typeinfo=msg.data.data[0].typeinfo;
                                }else{
                                    this.clientForm.clientId="";
                                }
                            });
                            addCaseService.queryCaseLaw(this.$http,this.searchCard.caseOppositeCardnum,this.searchCard.cardnum).then(msg=>{
                                if(msg.data.data.list.length===0){
                                    this.show=true;
                                    this.caseLaw=[];
                                    this.$message({
                                        type:"success",
                                        message:"暂未冲突,可以执行添加~"
                                    });
                                    this.$loading().close()
                                }else{
                                    this.show=false;
                                    this.caseLaw=msg.data.data.list;
                                    this.$message({
                                        type:"warning",
                                        message:"查询到冲突,不可执行添加!"
                                    });
                                    this.$loading().close()
                                }
                            })
                        }else{
                            this.$message({
                                type:"error",
                                message:"请正确填写委托人&对方当事人证件号!"
                            })
                        }
                    })
                }
            },
            hidden(){//修改证件号重新审查
                this.show=false
            },
            formatStatus(row, column, cellValue){//结案情况
                if (cellValue === "Y"){
                    return '已结案';
                }else {
                    return '未结案';
                }
            },
            caseDataPreparation(){
                this.xt=false;
                addCaseService.queryCaseAccept(this.$http).then(msg=>{//受理机关
                    this.caseAccept=msg.data.data
                });
                addCaseService.queryCaseCourt(this.$http).then(msg=>{//受理法院
                    this.caseCourt=msg.data.data
                });
                addCaseService.queryCaseNo(this.$http).then(msg=>{//处理案号
                    let data;
                    if (msg.data.data==null){
                        data="1";
                    }else{
                        data =(parseInt(msg.data.data)+1)+"";
                    }
                    if(data.length===1){
                        data="2021("+this.caseTypeContext+")第000"+data+"号"
                    }else if(data.length===2){
                        data="2021("+this.caseTypeContext+")第00"+data+"号"
                    }else if(data.length===3){
                        data="2021("+this.caseTypeContext+")第0"+data+"号"
                    }else{
                        data="2021("+this.caseTypeContext+")第"+data+"号"
                    }
                    this.caseForm.caseNo=data;
                    this.caseForm.caseWtr=this.client;
                    this.cwForm.zhuBanLvShi=JSON.parse(localStorage["user"])[0].userRealname
                    this.caseForm.caseOppositeCardnum=this.searchCard.caseOppositeCardnum
                });
            },
            tianjia(){//跳转第三步
                this.active++;
                this.clientForm.cardnum=this.searchCard.cardnum;
                if(this.clientForm.clientId!==""){
                    this.caseDataPreparation();
                    setTimeout(()=>{
                        this.active++;
                    },2000);
                    this.$alert('此客户已存在,即将跳转立案...', '提示', {
                        confirmButtonText: '确定',
                        customClass: 'myAlert',
                        callback: () => {
                            this.$message({
                                type: 'info',
                                message: `已为您自动跳转~`
                            });
                        }
                    });
                    return new Promise((resolve) => {
                        setTimeout(() => {
                            $('.myAlert').find('.el-button').trigger('click');
                            resolve();
                        }, 2000);
                    })
                }
                this.queryTypes();
            },
        }
    }
</script>

<style scoped>
    /*表单描述*/
    .el-form-item{
        font-weight: bold;
    }
    .case_type ul,.case_item ul {
        padding: 0;
        max-width: 1280px;
    }
    .case_type,ul,a,.case_item{
        margin: 0;
        padding: 0;
    }
    *{
        box-sizing: border-box;
        list-style: none;
    }
    .case_type,.case_item {
        width: 100%;
        padding: 10px;
        margin-top: 20px;
    }
    .case_type li{
        box-sizing: border-box;
        width: 140px;
        height: 40px;
        border-radius: 4px;
        background: #ededed;
        text-align: center;
        line-height: 36px;
        float: left;
        margin-right: 20px;
        margin-bottom: 20px;
        color: #fff !important;
        border: 2px solid transparent;
        transition: all 0.2s ease-out;
    }
    ul>li {
        list-style: none;
        dispaly:inline;
        /*border:1px solid;*/
    }
    .case_type a{
        display: block;
        color: #333;
        width: 140px;
    }
    a {
        background-color: transparent;
        text-decoration: none;
    }
    .case_type a:hover{
        color: #777;
        border: 3px solid pink;
        border-radius: 2px;
    }
    .case_item a {
        color: #333;
        height: 49px;
        display: block;
        border: 1px solid #cecece;
        text-align: center;
        padding: 6px 14px;
        border-radius: 4px;
        transition: all 0.2s ease-out;
        background-color: white;
    }
    .case_item li{
        box-sizing: border-box;
        height: 50px;
        border-radius: 4px;
        background: #ededed;
        text-align: center;
        line-height: 36px;
        float: left;
        margin-right: 20px;
        margin-bottom: 20px;
        color: #fff !important;
        /*border: 2px solid transparent;*/
        transition: all 0.2s ease-out;
    }
    .case_item a:hover{
        background-color: transparent;
    }
</style>